// -*-C++-*-

#pragma once
#ifndef MEMDISK_HEADER
#define MEMDISK_HEADER

#include "fs/disk.hpp"
#include "fs/memdisk.hpp"

namespace fs
{
  // new singleton interface for the memdisk
  inline Disk& memdisk()
  {
    static Disk    disk {MemDisk::get()};
    return disk;
  }
  // new_shared_memdisk() very likely contains FAT
  inline Disk_ptr shared_memdisk()
  {
    static std::weak_ptr<Disk> disk;

    if(auto ptr = disk.lock())
      return ptr;

    auto ptr = std::make_shared<Disk>(MemDisk::get());
    disk = ptr;
    return ptr;
  }
}

#endif
